<template>

    <div class="table">
        <el-table :data="list"  style="width: 90%">
    <el-table-column v-for="item in tableLabel" :key="item.prop" :prop="item.prop" :label="item.label" width="180" />
  </el-table>
    </div>
  
</template>


<script setup>
import { getCurrentInstance,onMounted, reactive, ref, } from 'vue'
const {proxy} =getCurrentInstance()

const list = ref([])

const tableLabel = reactive([
    {
        prop:'name',
        label:'姓名'
    },
    {
        prop:'age',
        label:'年龄'
    },
    {
        prop:'sex',
        label:'性别'
    },
    {
        prop:'birth',
        label:'出生日期'
    },
    {
        prop:'addr',
        label:'地址'
    },
])


const getUserData =async ()=>{
    let res = await proxy.$api.getUserData()
    console.log(res);
    list.value=res.list
    
}
onMounted(()=>{
    getUserData()
})


</script>